Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't change order of variables when NLPBlock is used #850

Merged
merged 1 commit into from
Aug 23, 2019
Merged

Conversation

blegat
Copy link
Member

@blegat blegat commented Aug 23, 2019

Closes #849

@codecov-io
Copy link

codecov-io commented Aug 23, 2019

Codecov Report

Merging #850 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #850      +/-   ##
==========================================
+ Coverage   94.89%   94.95%   +0.05%     
==========================================
  Files          72       72              
  Lines        7939     7942       +3     
==========================================
+ Hits         7534     7541       +7     
+ Misses        405      401       -4
Impacted Files Coverage Δ
src/Utilities/copy.jl 92.71% <100%> (+2.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fd2afe...3ef0d90. Read the comment docs.

@blegat
Copy link
Member Author

blegat commented Aug 23, 2019

I have verified that it does fix the failure on mle.jl in JuMP examples:
https://travis-ci.org/JuliaOpt/JuMP.jl/jobs/575715644#L504

@blegat blegat merged commit 6ac4e6d into master Aug 23, 2019
end
# The `NLPBlock` assumes that the order of variables does not change (#849)
if MOI.NLPBlock() in MOI.get(src, MOI.ListOfModelAttributesSet())
vector_of_variables_not_added = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do this only for NLPBlock and not always?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean first determine how each variable is going to be added (either free or constrained) and then add them in the same order (hence splitting the add_variables call in separate one for each contiguous block) so that they are added in the same order even if some variables are contrained ?

Note that with #846, the need to not change the order of the variables might go away. The assumption that variables have indices 1 to n that is used by NLP in MOI does not match the rest of the MOI ecosystem and it will go away once NonlinearExpressionFunction implements map_variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

map_indices(, ::MOI.NLPBlockData) is wrong
3 participants